// 引用公共样式
import './assets/app.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' //引入持久化插件

import App from './App.vue'

//导入Elementplus
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'

import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import router from './router/index'
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
const app = createApp(App)

// 注册系统库
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  // console.log('key',key)
  app.component(key, component)
}

//全局组件 (在Vue文件中使用之前 不需要import)
app.use(ElementPlus, {
  locale: zhCn,
  size: 'default',
})

app.use(pinia)
//注册全局组件
app.use(router)

app.mount('#app')
